<%--
  @author Tharanga Punchihewa
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript ">
    $(document).ready(function() {
        $('.land-table').dataTable({
            "oTableTools": {
                "aButtons": [
                    {
                        "sExtends": "print",
                        "bShowAll": true
                    }
                ]
            }
        });
    });
</script>
<div id="user-module-home-title" class="module-home-title">
    <s:a href="organizationUserManagementHome.do"><img src="${pageContext.request.contextPath}/images/user.png"
                                                              alt="User Module"><span><s:label
            value="%{getText('user_module.label')}"/></span></s:a>
    <span class="module-title-breaker"> > </span>
    <s:a href="#"><img src="${pageContext.request.contextPath}/images/update-user.png"
                       alt="User Module"><span><s:label
            value="%{getText('manage_urmgoi_user.label')}"/></span></s:a>
</div>
<div class="page-title">
    <h2><s:label value="%{getText('manage_urmgoi_user.label')}"/></h2>
</div>
<table class="width-100 margin-10-auto table land-table">
    <thead>
    <tr class="center-align table-header">
        <th class="width-450-px"><s:label/><s:label value="UR-MGOI  "/><s:label value="%{getText('name.label'}"/></th>
        <s:if test="user.role.id=='ORPII'">
            <th><s:label/></th>
            <th><s:label/></th>
        </s:if>
        <s:if test="user.role.id=='ORMOI'">
            <th><s:label/></th>
        </s:if>
    </tr>
    </thead>
    <tbody>
    <s:iterator status="status1" value="urmgoiUserList">
        <tr>
            <td class="center-align"><s:property value="userDetail.name"/></td>
            <s:if test="user.role.id=='ORPII'">
                <td class="center-align"><s:url id="initEditURMGOIUser" action="initEditURMGOIUser">
                    <s:param name="urmgoiUserId" value="id"/>
                </s:url>
                    <s:a href="%{initEditURMGOIUser}">
                        <img src="<s:url value='/images/modify-form.png'/>" border="none" width="25"
                             height="25" title="Edit"/>
                    </s:a>
                </td>
                <td class="center-align">
                        <%--If the ORPII User is inactive ORMOI can active ORPII--%>
                    <s:if test="status.ordinal()==1">
                        <s:url id="activeURMGOIUser" action="activeURMGOIUser">
                            <s:param name="urmgoiUserId" value="id"/>
                        </s:url>
                        <s:a href="%{activeURMGOIUser}">
                            <img src="<s:url value='/images/approve.png'/>" class="image-icon" title="Active"/>
                        </s:a>
                    </s:if>
                        <%--If the ORPII User is active ORMOI can inactive ORPII--%>
                    <s:if test="status.ordinal()== 0">
                        <s:url id="inactiveURMGOIUser" action="inactiveURMGOIUser">
                            <s:param name="urmgoiUserId" value="id"/>
                        </s:url>
                        <s:a href="%{inactiveURMGOIUser}">
                            <img src="<s:url value='/images/reject.png'/>" class="image-icon" title="Inactive"/>
                        </s:a>
                    </s:if>
                </td>
            </s:if>
            <s:if test="user.role.id=='ORMOI'">
                <td class="center-align">
                    <s:url id="initCreateURMGOIUser" action="initCreateURMGOIUser">
                        <s:param name="urmgoiUserId" value="id"/>
                    </s:url>
                    <s:a href="%{initCreateURMGOIUser}">
                        <img src="<s:url value='/images/people.png'/>" class="image-icon" title="Create"/>
                    </s:a>
                </td>
            </s:if>
        </tr>
    </s:iterator>
    </tbody>
</table>